package com.module.shici.bean;


import com.module.shici.room.Music;
import com.module.shici.room.MusicDao;
import com.module.shici.room.MusicDataBase;

import java.util.ArrayList;
import java.util.List;

public class YinpinData {

    private List<Music> storyList,ergeList,pianoList,collectList;
    private MusicDao musicDao = MusicDataBase.getInstance().getMusicDao();

    public List<Music> getStoryList(){
        if (storyList == null){
            storyList = musicDao.getGongzhugushiList();
            storyList.addAll(musicDao.getShaoerbaikeList());
            storyList.addAll(musicDao.getYinxiaoggushiList());
        }
        return storyList;
    }

    public List<Music> getErgeList(){
        if (ergeList == null){
            ergeList = musicDao.getErgeList();
        }
        return ergeList;
    }

    public List<Music> getPianoList(){
        if (pianoList == null){
            pianoList = new ArrayList<>();
            pianoList.addAll(musicDao.getErgeList().subList(156,176));
        }
        return pianoList;
    }

    public List<Music> getCollectList(){
        //每次获取都应该是最新的
        collectList = musicDao.getCollect();
        return collectList;
    }
}
